package org.joy;

//import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
//import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider;
//import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
//import software.amazon.awssdk.core.ResponseInputStream;
//import software.amazon.awssdk.http.SdkHttpClient;
//import software.amazon.awssdk.http.SdkHttpConfigurationOption;
//import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
//import software.amazon.awssdk.regions.Region;
//import software.amazon.awssdk.services.s3.S3Client;
//import software.amazon.awssdk.services.s3.model.GetObjectRequest;
//import software.amazon.awssdk.services.s3.model.GetObjectResponse;
//import software.amazon.awssdk.utils.AttributeMap;

import java.io.IOException;

public class S3v2Function {
//    static String accessid = "af35bca66ece7f61f43de668588f6da936e9b414";
//    static String secretKey = "Zdf0NyiRdAhjvx4MZIq27diFKRsrTlFFlIgyvkj2QhE=";
    public static void main(String[] args) throws IOException {
//        SdkHttpClient httpClient = UrlConnectionHttpClient
//                .builder()
//                .buildWithDefaults(AttributeMap.builder()
//                        .put(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES, Boolean.TRUE)
//                        .build());     //important
//
//        S3Client s3 = S3Client.builder()
//                .credentialsProvider(InstanceProfileCredentialsProvider.create())
////                .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessid, secretKey)))
//                .httpClient(httpClient)    //important
//                .region(Region.of("sa-saopaulo-1"))
//                .endpointOverride(URI.create("https://cn8nzpwnextf.compat.objectstorage.sa-saopaulo-1.oraclecloud.com"))
//                .build();
//        ResponseInputStream<GetObjectResponse> responseInputStream = s3.getObject(GetObjectRequest.builder().bucket("cn8nzpwnextf").key("buckettest/oss.lua").build());
//        byte[] bytes = responseInputStream.readAllBytes() ;
//        System.out.println(new String(bytes));
//        s3.close();

    }
}
